/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Aug 28, 2013  3:41:05 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : com.tis.database.services.security.impl
 * File Name : AdUserLoginServicesImpl.java
 * TODO
 */
package com.tis.database.services.security.impl;

import java.math.BigDecimal;
import java.util.List;

import org.hibernate.HibernateException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.tis.database.dao.security.AdUserLoginDao;
import com.tis.database.entitys.security.AdUserLogin;
import com.tis.database.services.security.IAdUserLoginServices;

/**
 * @author Administrator
 *
 */
@Service
@Transactional(readOnly = true, propagation=Propagation.REQUIRES_NEW)
public class AdUserLoginServicesImpl implements IAdUserLoginServices{
	
	private static final Logger log = LoggerFactory.getLogger(AdUserLoginServicesImpl.class);

	@Autowired
	private AdUserLoginDao adUserLoginDao;
	
	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByUserLogin(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByUserLogin(String userLogin) throws HibernateException, Exception {
		
		return adUserLoginDao.findByUserLogin(userLogin);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByFirstName(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByFirstName(String firstName) throws HibernateException{
		
		return adUserLoginDao.findByFirstName(firstName);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByLastedName(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByLastedName(String lastName) throws HibernateException{
		
		return adUserLoginDao.findByLastedName(lastName);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByDescription(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByDescription(String description) throws HibernateException{
		
		return adUserLoginDao.findByDescription(description);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByIsActive(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByIsActive(String isactive) throws HibernateException{
		
		return adUserLoginDao.findByIsActive(isactive);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByIsDelete(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByIsDelete(String isdeleted) throws HibernateException{
		
		return adUserLoginDao.findByIsDelete(isdeleted);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByStatus(java.lang.String)
	 */
	@Override
	public List<AdUserLogin> findByStatus(String status) throws HibernateException{
		
		return adUserLoginDao.findByStatus(status);
	}

	/* (non-Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByUserPassword(java.lang.String, java.lang.String)
	 */
	@Override
	public AdUserLogin findByUserPassword(String user, String password) throws HibernateException{
		
		return adUserLoginDao.findByUserPassword(user, password);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#NextSequence(java.lang.String)
	 * Date =Sep 26, 2013 : 2:18:12 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public BigDecimal NextSequence(String name) throws HibernateException, Exception {
		return adUserLoginDao.NextSequence(name);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#saveOrUpdate(com.tis.database.entitys.security.AdUserLogin)
	 * Date =Sep 26, 2013 : 4:31:26 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly = false)
	public void saveOrUpdate(AdUserLogin e) throws HibernateException {
		adUserLoginDao.saveOrUpdate(e);
		
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#save(com.tis.database.entitys.security.AdUserLogin)
	 * Date =Sep 26, 2013 : 4:31:26 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly = false)
	public void save(AdUserLogin e) throws HibernateException {
		adUserLoginDao.save(e);
		
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#StampLastedUserAccess(com.tis.database.entitys.security.AdUserLogin)
	 * Date =Sep 26, 2013 : 4:36:24 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly = false)
	public void StampLastedUserAccess(AdUserLogin e) throws HibernateException, Exception {
		adUserLoginDao.StampLastedUserAccess(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByAll(int)
	 * Date =Oct 1, 2013 : 10:09:42 AM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<AdUserLogin> findByAll(int maxResults) throws HibernateException, Exception {
		return adUserLoginDao.findByAll(maxResults);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findById(java.math.BigDecimal)
	 * Date =Oct 1, 2013 : 3:01:09 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public AdUserLogin findById(BigDecimal id) throws HibernateException, Exception {
		return adUserLoginDao.findById(id);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.security.IAdUserLoginServices#findByAll(int, java.lang.String, java.lang.String, java.lang.String)
	 * Date =Oct 1, 2013 : 3:42:35 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<AdUserLogin> findByAll(int maxResults, String isDelete, String isActive, String status) throws HibernateException, Exception {

		return adUserLoginDao.findByAll(maxResults, isDelete, isActive, status);
	}

}
